package cn.wolfcode.trip.app.controller;

import cn.wolfcode.trip.base.service.IDailyCommentService;
import cn.wolfcode.trip.base.service.IStrategyCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/*
* 接口:根据userId查询所有的评论
* */
@RestController
@RequestMapping("/comments")
public class CommentController {
    @Autowired
    private IDailyCommentService dailyCommentService;
    @Autowired
    private IStrategyCommentService strategyCommentService;

    @GetMapping("{userId}")
    public Map<String,Object> queryAllComments(@PathVariable Long userId){
        List dailyComments=dailyCommentService.queryComments(userId);
        List  strategyComments=strategyCommentService.queryComments(userId);
        Map<String,Object> map=new HashMap<>();
        map.put("dailyComments",dailyComments);
        map.put("strategyComments",strategyComments);
        return map;
    }


}
